<?php
namespace app\controller\open;

use app\service\AppInfoTableService;
use app\validate\VendorValidate;

class VendorController extends BaseOpenController{

    protected $beforeActionList = [
    ];
    public function initValidate(){
        $this->validate = new VendorValidate();
    }

    public function info_action(){
        $input = $this->check();
        $vendor = strtoupper(trim($input['vendor']));
        $simpleVendor = AppInfoTableService::getSimpleVendor($vendor);
        if(!empty($simpleVendor)){
            $vendor = $simpleVendor;
        }        
        $appInfo = AppInfoTableService::getAllByFilter(["vendor" => $vendor]);
        return self::ok(['app'=>$appInfo]);
    }
}